package com.cskaoyan.dbutils.resultSetHandler;

import com.cskaoyan.bean.Account;
import com.cskaoyan.datasource.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * 创建日期: 2022/07/02 11:04
 *
 * @author ciggar
 */
public class BeanListHandlerDemo {

    public static void main(String[] args) throws SQLException {

        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        List<Account> accountList = queryRunner.query("select * from account", new BeanListHandler<>(Account.class));

        System.out.println(accountList);

    }
}
